Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: timeInputV2 #4635

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

feat: timeInputV2 #4635

wants to merge 2 commits into from

Conversation

lisalupi
Copy link
Contributor

@lisalupi lisalupi commented Jan 2, 2025

Summary

Type

  • Feature

Summarise concisely:

What is expected?

New component <TimeInputV2 />

@lisalupi lisalupi self-assigned this Jan 2, 2025
@lisalupi lisalupi requested a review from matthprost as a code owner January 2, 2025 14:36
Copy link

changeset-bot bot commented Jan 2, 2025

🦋 Changeset detected

Latest commit: 8d2493c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@ultraviolet/ui Minor
@ultraviolet/form Patch
@ultraviolet/plus Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

codecov bot commented Jan 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.76%. Comparing base (2205ef6) to head (8d2493c).
Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4635      +/-   ##
==========================================
+ Coverage   87.43%   87.76%   +0.32%     
==========================================
  Files         335      340       +5     
  Lines       12722    13064     +342     
  Branches     3471     3571     +100     
==========================================
+ Hits        11124    11466     +342     
  Misses       1598     1598              
Files with missing lines Coverage Δ
...rc/components/TimeInputV2/__tests__/helper.test.ts 100.00% <100.00%> (ø)
...rc/components/TimeInputV2/__tests__/index.test.tsx 100.00% <100.00%> (ø)
...ackages/ui/src/components/TimeInputV2/constants.ts 100.00% <100.00%> (ø)
packages/ui/src/components/TimeInputV2/helpers.ts 100.00% <100.00%> (ø)
packages/ui/src/components/TimeInputV2/index.tsx 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a40bd38...8d2493c. Read the comment docs.

"@ultraviolet/ui": minor
---

New component `<TimeInputV2 />`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you implement TimeInputField at same time ? 😅

packages/ui/src/components/index.ts Show resolved Hide resolved
@@ -67,6 +67,7 @@ export { TextArea } from './TextArea'
export { TextInput } from './TextInput'
export { TextInputV2 } from './TextInputV2'
export { TimeInput } from './TimeInput'
export { TimeInputV2, type Time } from './TimeInputV2'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what is the purpose of the readonly as you cannot select the content. @mhervouet can you confirm if we need this state and if yes what should be possible to do/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok for readonly you can do same as NextUI

{timeFormat === 12 ? (
<Input
value={time.period?.toUpperCase()}
placeholder={placeholder.period ?? '-M'}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say we should set AM instead of -M

}

return (
<Stack key={type} gap={0} direction="row">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Stack key={type} gap={0} direction="row">
<Stack key={type} direction="row">

I don't think its needed

readOnly?: boolean
error?: boolean | string
'data-testid'?: string
onChange?: (time: Time, timePeriod?: string) => void
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onChange?: (time: Time, timePeriod?: string) => void
onChange?: (value: Time, valuePeriod?: string) => void

To be consistent between our inputs

data-readonly={readOnly}
readOnly
disabled={disabled}
aria-label={`${fullName()}-input`}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aria label should be set via a prop instead. It should be set when no label is set to give indication to screen reader.

Comment on lines +165 to +167
size?: 'small' | 'medium' | 'large'
timeFormat?: 12 | 24
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here you could add aria-label and conditionally required either label or aria-label

clearable?: boolean
required?: boolean
labelDescription?: ReactNode
helper?: string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be a react node, sometimes we need to add a link in the helper

}

return (
<Stack gap={0.5} className={className} id={id} data-testid={dataTestId}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The id and data-testid should be on the TimeInputWrapper instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants